import json
import requests
import sys
from returnExcult_100508062 import *

def func(data):
    reTest.test(data)
    return reTest.test(data)


if __name__ == '__main__':
    # step1
    jsonStr = sys.argv[1]
    # # 编写python 调用 java 数据网关的接口返回 数据
    std = json.loads(jsonStr)
    # result dict result的类型
    # 把字典转成字符串
    result = {"apiName": "身份证二要素验证", "secret": "e7a87080efba4134ad63efd158aa32e0", "shortName": "br"}
    result["name"] = std["name"]
    result["id"] = std["id"]
    str = json.dumps(result)
    # 调用数据网关接口 得到结果
    host = 'http://zebra.dev.com'
    server_name = '/service-interface-gateway'
    method = '/api/invoke'
    url = host + server_name + method
    header_dict = {"Content-Type": "application/json; charset=utf8"}
    r = requests.post(url, data=str, headers=header_dict)
    json_data = ''
    if (r.ok):
        json_data = r.json()
    print(func(json_data))